package com.cf.controller;

import com.cf.enums.Area;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/uis")
public class UIController {

    /**
     * 首页跳转
     * @return
     */
    @RequestMapping("/")
    public String index() {
        return "index/index";
//        return "index";
    }

    /**
     * 大赛规则页面跳转
     * @return
     */
    @RequestMapping("/rule")
    public String rule() {
        return "home/rule";
    }

    /**
     * 大赛报名页面跳转
     * @return
     */
    @RequestMapping("/enrollUI")
    public String enrollUI() {
        return "home/enroll";
    }

    /**
     * 公益行页面跳转
     * @return
     */
    @RequestMapping("/welfareUI")
    public String welfareUI() {
        return "home/welfare";
    }

    /**
     * 对外合作页面跳转
     * @return
     */
    @RequestMapping("/cooperUI")
    public String cooperUI() {
        return "home/cooper";
    }

    /**
     * 对外合作页面-企业合作跳转
     * @return
     */
    @RequestMapping("/cooper/qyUI")
    public String qyUI() {
        return "home/cooper/qy";
    }

    /**
     * 对外合作页面-个人合作跳转
     * @return
     */
    @RequestMapping("/cooper/grUI")
    public String grUI() {
        return "home/cooper/gr";
    }

    /**
     * 对外合作页面-高校合作跳转
     * @return
     */
    @RequestMapping("/cooper/gxUI")
    public String gxUI() {
        return "home/cooper/gx";
    }

    /**
     * 对外合作页面-商务合作跳转
     * @return
     */
    @RequestMapping("/cooper/swUI")
    public String swUI() {
        return "home/cooper/sw";
    }

    /**
     * 登陆页跳转
     * @return
     */
    @GetMapping("/loginUI")
    public String loginUI(){
        return "home/login";
    }

    /**
     * 注册页跳转
     * @return
     */
    @GetMapping("/registerUI")
    public String registerUI(Model model){
        Area[] areas = Area.values();
        model.addAttribute("areas", areas);
        return "home/register";
    }

    /**
     * 文件下载页跳转
     * @return
     */
    @GetMapping("/infomations")
    public String registerUI(){
        return "home/informations";
    }

    /**
     * 通知页跳转
     * @return
     */
    @GetMapping("/noticeUI")
    public String noticeUI(){
        return "home/notice";
    }

    /**
     * 密码修改页面跳转
     * @return
     */
    @RequestMapping("/updatePwdUI")
    public String updatePwdUI() {
        return "user/pwd";
    }

    /**
     * 评委管理跳转
     * @return
     */
    @RequestMapping("/judgesUI")
    public String judgesUI() {
        return "admin/judges";
    }

    /**
     * 评分选项管理跳转
     * @return
     */
    @RequestMapping("/scoreOptionsUI")
    public String scoreOptionsUI() {
        return "admin/scoreOptions";
    }

    /**
     * 赛场管理跳转
     * @return
     */
    @RequestMapping("/groundsUI")
    public String groundsUI() {
        return "admin/ground";
    }

    /**
     * 打分页面
     * @return
     */
    @RequestMapping("/scoreUI")
    public String scoreUI(@RequestParam(name = "userId") Long userId,
                          @RequestParam(name = "groundId") Long groundId,
                           Model model) {
        model.addAttribute("userId", userId);
        model.addAttribute("groundId", groundId);
        return "score/score";
    }

    /**
     * 赛场选择
     * @return
     */
    @RequestMapping("/groundUI")
    public String groundUI() {
        return "score/ground";
    }

    /**
     * 主屏幕
     * @return
     */
    @RequestMapping("/screenUI")
    public String screenUI() {
        return "score/screen";
    }

    /**
     * 分屏幕
     * @return
     */
    @RequestMapping("/screenGroupUI")
    public String screenGroupUI() {
        return "score/screenGroup";
    }

    @RequestMapping("/loginUI1")
    public String loginUI1() {
        return "score/login";
    }

    @RequestMapping("/listUI")
    public String listUI(@RequestParam(name = "id") Long id,
                         Model model) {
        model.addAttribute("newsId", id);
        return "index/content";
    }

    @RequestMapping("/detailUI")
    public String detailUI(@RequestParam(name = "id") Long id,
                         Model model) {
        model.addAttribute("newsId", id);
        return "index/detail";
    }

    /**
     * 证书查询页面跳转
     * @return
     */
    @RequestMapping("/searchUI")
    public String searchUI() {
        return "index/certSearch";
    }

}
